package cn.edu.hqu.example.bj.experiment_2;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class LinerLayoutActivity extends AppCompatActivity {



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_liner_layout2);

        final LinearLayout horiLay = this.findViewById(R.id.linetLayout);

        Button bt_6 = findViewById(R.id.bt_6);
        Button bt_7 = findViewById(R.id.bt_7);
        Button bt_8 = findViewById(R.id.bt_8);
        Button bt_9 = findViewById(R.id.bt_9);

        bt_6.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                horiLay.setOrientation(LinearLayout.HORIZONTAL);
                horiLay.setHorizontalGravity(Gravity.CENTER);
            }
        });
        bt_7.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                horiLay.setOrientation(LinearLayout.VERTICAL);
                horiLay.setHorizontalGravity(Gravity.CENTER);
            }
        });
        bt_8.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                horiLay.setOrientation(LinearLayout.VERTICAL);
                horiLay.setHorizontalGravity(Gravity.LEFT);
            }
        });
        bt_9.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }
}
